<?php echo $this -> Html -> css('Base/index'); ?>

<!-- BEGIN PAGE CONTENT-->
<div class="box">
	<div class="box-header">
		<h3 class="box-title">Danh mục</h3>
	</div><!-- /.box-header -->
	<div class="btn-add-element">
		<?php echo $this->Html->link('Add', array(
                'controller' => 'CategoryManage', 
                'action' => 'radd'), 
                array('class' => 'btn btn-primary')); 
                ?>
    </div>
	<!--thong bao-->
	<?php echo $this->Session->flash();?>
	<!--/thong bao-->

	<div class="box-body table-responsive">
		<!-- BEGIN TABLE PRODUCTS LIST-->
		<table id="example1" class="table table-bordered table-striped">
			<thead>
				<tr>
					<th>Tên Danh mục</th>
					<th>Sửa</th>
					<th>Xóa</th>
					
				</tr>
			</thead>
			<tbody>
				    <?php foreach($data as $item){?>
						<tr>
							<td><?php echo $item['root_categories']['category_name'];?></td>
							<td>
								<a class="btn btn-warning" href="/admin/CategoryManage/redit/<?php echo $item['root_categories']['id'] ?>">
								 	Chỉnh sửa
								</a>
							</td>
							<td>
								 <a class="btn btn-danger" href="/admin/CategoryManage/rdelete/<?php echo $item['root_categories']['id'] ?>"
								 	onclick="if (confirm('Bạn có muốn xóa?')) { return true; } return false;">
								 	Xóa
								 </a>
							</td>
						</tr>
					<?php }?>
			</tbody>
		</table>
		<!-- END TABLE PRODUCTS LIST-->
	</div><!-- /.box-body -->
	 <!-- BEGIN PAGINATION -->
   	 <?php 
    	/*if ($this -> Paginator -> counter('{:pages}') > 1){
    		echo $this->element('paginationAdmin', array('Paginator' => $this->Paginator));
		}*/
    ?>
	<!-- END PAGINATION -->
</div><!-- /.box -->
<!-- END PAGE CONTENT -->

<!-- page script -->
<script>
	$(document).ready(function() {
		$("#data_id").change(function(){
			$(this).closest("form").submit();
		});
	});
</script>